:root {
  --modal-space: 8;
  --modal-width: calc(var(--modal-space) * 4);
}

.modal {
  background-color: hsl(var(--theme-primary-010));
  border-radius: calc(var(--theme-radius) * 0.01em);
  box-shadow: var(--theme-shadow-bottom-large);
  position: fixed;
  top: 50%;
  left: 50%;
  font-size: 1em;
  max-height: calc(100vh - 2em);
  width: calc(var(--modal-width) * 1em);
  max-width: calc(100% - 2em);
  min-width: 10em;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
  transform: translate(-50%, -50%);
  overflow: hidden;
  pointer-events: all;
  opacity: 0;
  transition: background-color var(--layout-transition-extra-fast), opacity var(--layout-transition-extra-fast);
  z-index: var(--z-index-modal);
}

.modal.is-transparent {
  pointer-events: none;
}

.modal.modal-max-height {
  min-height: calc(100vh - 2em);
}

.modal-content-wrapper {
  padding: calc((var(--modal-space) / 2) * 0.75em) calc((var(--modal-space) / 2) * 1em);
  position: relative;
  overflow-y: auto;
}

.modal-content {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  justify-items: stretch;
  align-items: stretch;
  gap: calc((var(--modal-space) / 4) * 1em);
}

.modal-body {
  border-radius: calc(var(--theme-radius) * 0.01em) calc(var(--theme-radius) * 0.01em) 0 0;
  position: relative;
}

.modal-heading {
  overflow: hidden;
}

.modal-heading-text {
  margin-bottom: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-heading-text:focus {
  outline: none;
}

.modal-container {
  max-width: 100%;
}

.modal-container:focus {
  outline: none;
}

.modal-control {
  background-color: hsl(var(--theme-primary-010));
  border-radius: 0 0 calc(var(--theme-radius) * 0.01em) calc(var(--theme-radius) * 0.01em);
  position: relative;
  z-index: 2;
  display: flex;
  transition: background-color var(--layout-transition-extra-fast);
}

.modal-control-button {
  background-color: transparent;
  margin: 0;
  border-radius: 0;
  padding-top: 1.5em;
  padding-bottom: 1.5em;
  flex-basis: 50%;
}

.modal-control .modal-control-button:first-child,
.modal-control .modal-control-button:first-child:after {
  border-radius: 0 0 0 calc(var(--theme-radius) * 0.01em);
}

.modal-control .modal-control-button:last-child,
.modal-control .modal-control-button:last-child:after {
  border-radius: 0 0 calc(var(--theme-radius) * 0.01em) 0
}
